package o;

import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import com.huawei.appgallery.serverreqkit.api.bean.ResponseBean;
import com.huawei.appgallery.serverreqkit.api.listener.IServerCallBack;
import com.huawei.gamebox.plugin.gameservice.bean.GameInfo;
import com.huawei.gamebox.plugin.gameservice.bean.RealName;

class fap {
    private fav ˊ;
    private Handler ˎ;
    private fao ˏ;
    private Context ॱ;

    fap() {
    }

    void ॱ(Context context, GameInfo gameInfo, RealName realName, fao o_fao, fav o_fav) {
        this.ˏ = o_fao;
        this.ॱ = context;
        this.ˊ = o_fav;
        ॱ();
        ˊ(gameInfo, realName);
    }

    private void ˊ(GameInfo gameInfo, RealName realName) {
        fbh.ˋ(ezd.ˏ(gameInfo, realName), new IServerCallBack(this) {
            final /* synthetic */ fap ॱ;

            {
                this.ॱ = r1;
            }

            public void prePostResult(BaseRequest o_cvu, ResponseBean responseBean) {
            }

            public void notifyResult(BaseRequest o_cvu, ResponseBean responseBean) {
                if (this.ॱ.ˎ == null) {
                    Logger.e("RealNameAuth", "msgHandler is null");
                } else if ((responseBean instanceof eze) && responseBean.getResponseCode() == 0 && responseBean.getRtnCode_() == 0) {
                    Message message = new Message();
                    message.what = 2;
                    this.ॱ.ˎ.sendMessage(message);
                } else {
                    int rtnCode_ = responseBean != null ? responseBean.getRtnCode_() : -1;
                    Message message2 = new Message();
                    message2.what = 1;
                    Bundle bundle = new Bundle();
                    bundle.putInt("ErrorCode", rtnCode_);
                    message2.setData(bundle);
                    this.ॱ.ˎ.sendMessage(message2);
                }
            }
        });
    }

    private void ॱ() {
        this.ˎ = new Handler(this, this.ॱ.getMainLooper()) {
            final /* synthetic */ fap ॱ;

            public void handleMessage(Message message) {
                switch (message.what) {
                    case 1:
                        if (Logger.ˎ()) {
                            Logger.ˏ("RealNameAuth", "handle show error msg");
                        }
                        Bundle data = message.getData();
                        int i = -1;
                        if (data != null) {
                            i = data.getInt("ErrorCode");
                        }
                        if (this.ॱ.ˏ != null) {
                            this.ॱ.ˏ.ˏ(i, true);
                            return;
                        }
                        return;
                    case 2:
                        if (this.ॱ.ˏ != null) {
                            this.ॱ.ˏ.ᐝ();
                        }
                        if (this.ॱ.ˊ != null) {
                            this.ॱ.ˊ.ˋ(1);
                            return;
                        }
                        return;
                    case 3:
                        if (Logger.ˎ()) {
                            Logger.ˏ("RealNameAuth", "handle hide progress dialog msg");
                        }
                        if (this.ॱ.ˏ != null) {
                            this.ॱ.ˏ.ˊ();
                            return;
                        }
                        return;
                    default:
                        return;
                }
            }
        };
    }
}
